package stage.manager;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.hibernate.*;

import stage.dao.HistoricalInfoDAO;
import stage.factory.DaoFactory;
import stage.pojo.HistoricalInfo;
import stage.tools.HibernateUtil;
/**
 * the service for one historical info. 
 * @author remi liu(Liu Zhibin)
 * @version 0.0
 */
public class HistoricalInfoService {
	public void save(HistoricalInfo h) throws Exception{
		try{
			Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.INFO, h.getIsExpert().toString());
			HistoricalInfoDAO hd=(HistoricalInfoDAO)DaoFactory.instance().getDao("HistoricalInfoDAO");
			Session s=HibernateUtil.sf.getCurrentSession();
			Transaction tx=s.beginTransaction();
			hd.save(s, h);
			tx.commit();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
